﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="admin_question_modify.aspx.cs" Inherits="skvote.admin_question_modify" %>

<%@ Import Namespace="System.Data.OleDb" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
<head>
<%skvote.function.header(Response);%>
<title>【单考投票系统】后台管理中心</title>
</head>
<body>
<table border="0" cellpadding="1" cellspacing="2" width="100%" id="table1" bgcolor="#E1F0FF">
  <tr>
    <td>
	   <table width="100%" id="table2" cellspacing="1">
	     <tr>
          <td id="TableTitle1"> 修改投票答案-&gt;</td>
		 </tr>
	   </table>
	 </td>
  </tr>
  <tr>
    <td><table border="1" cellpadding="4" cellspacing="0" width="100%" id="table2" bordercolor="#BFDFFF">
        <form action="" name="form3" method="post" id="form3" runat="server">
          <tr id="TableTitle2">
            <td align="center" colspan="2" bgcolor="#BFDFFF"><b>设置投票答案</b></td>
          </tr>
          <tr>
            <td align="right">选择投票问题：</td>
            <td><select name="ttid" id="ttid">
              <%
                  if (!string.IsNullOrEmpty(Request["id"]) && !string.IsNullOrEmpty(Request["tid"]))
                  {
                      OleDbConnection connection = new skvote.conn().CreateConnection();
                      try
                      {
                          connection.Close();
                          connection.Open();
                          OleDbCommand cmd = new OleDbCommand("select * from xh_subject order by id desc", connection);
                          OleDbDataReader dr = cmd.ExecuteReader();
                          while (dr.Read())
                          {
                              Response.Write("<optgroup label='" + dr["subject"].ToString() + "'>");
                              OleDbConnection tempconn = new skvote.conn().CreateConnection();
                              try
                              {
                                  OleDbCommand tempcmd = new OleDbCommand("select * from xh_title where sid=" + dr["id"].ToString(), connection);
                                  OleDbDataReader tempdr = tempcmd.ExecuteReader();
                                  while (tempdr.Read())
                                  {
                                      if (Request["tid"].Trim() == tempdr["id"].ToString().Trim())
                                      {
                                          Response.Write("<option value='" + tempdr["id"].ToString() + "' selected>" + tempdr["title"].ToString() + "</option>");
                                      }
                                      else
                                      {
                                          Response.Write("<option value='" + tempdr["id"].ToString() + "'>" + tempdr["title"].ToString() + "</option>");
                                      }
                                  }
                                  tempdr.Close();
                                  tempcmd.Dispose();
                              }
                              finally
                              {
                                  tempconn.Close();
                              }
                              Response.Write("</optgroup>");
                          }                          
                          dr.Close();
                          cmd.Dispose();
                      }
                      finally
                      {
                          connection.Close();
                      }
                  }
              %>
              </select></td>
          </tr>
          <tr>
            <td width="20%" align="right">投票答案名称：</td>
            <td><input type="text" name="question" size="25" value='<%=GetQuestion(Request["id"])%>' id="question">              </td>
          </tr>
          <tr>
            <td width="20%" align="right">票数：</td>
            <td><input type="text" name="ps" size="5" value="<%=GetPs(Request["id"])%>" id="ps"></td>
          </tr>
          <tr>
            <td colspan="2" align="center"><asp:Button ID="submit" runat="server" Text="修改" 
                    CssClass="btn" onclick="submit_Click" /></td>
          </tr>
        </form>
    </table></td>
  </tr>
</table>
</body>
</html>
